package com.example.bbook.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.*;

@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Data
@TableName("s_user")
public class UserEntity extends BaseEntity {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private String username;
    private String password;
    private String remark;
    private Integer admin;
    private String avatar;
    private String auth;
    private String salt;
    private Integer money;
    @TableField(exist = false)
    private SpeciesEntity speciesEntity;

    public UserEntity() {
        setColumns(new ArrayList<>());

        push("id", "number", "ID", new int[]{0, 1, 1, 0})
                .push("username", "string", "用户名", new int[]{1, 0, 1, 1})
                .push("remark", "string", "用户简介", new int[]{1, 0, 1, 0})
                .push("avatar", "image", "用户头像", new int[]{1, 0, 1, 0})
                .push("money", "number", "用户资产", new int[]{1, 0, 1, 0});
    }

    public ArrayList<HashMap<String, Object>> thisColumns() {
        return getColumns();
    }
}
